<?php include('./templete/public/head.php') ?>
<script src="_js/plug/menudown.js"></script>
<body>

<!--搜索-->
<div class="comm-search">
    <div class="search-input">
        <i class="iconfont icon-sousuo"></i>
        <input type="text" name="" id="title" value="<?php echo input('title') ?>" placeholder="请输入您要搜索的建议"
               onchange="search()"/>
    </div>
</div>
<!--搜索标签-->
<div class="search-tag">
    <div class="tag2">
        <ul class="topmenu">
            <!--请选择公司-->
            <li>
                <div class="selectlist">
                    <div class="select_textdiv">
                        <input type="hidden" id="question_type" value="">
                        <div>
                            <p class="s_text one-txt-cut">问题分类</p>
                            <span class="down"><i class="iconfont icon-xiaosanjiaodown"></i></span>
                        </div>
                    </div>
                    <div class="select_textul">
                        <ul class="select_first_ul">
                            <?php foreach ($cate as $key=>$val){?>
                            <li><p data-type="<?php echo $key?>"><?php echo $val?></p></li>
                            <?php }?>
                        </ul>
                    </div>
                </div>
            </li>
            <!--请选择问题-->
            <li>
                <div class="selectlist">
                    <div class="select_textdiv">
                        <input type="hidden" id="depart_id" value="">
                        <div>
                            <p class="s_text one-txt-cut">请选择部门</p>
                            <span class="down"><i class="iconfont icon-xiaosanjiaodown"></i></span>
                        </div>
                    </div>
                    <div class="select_textul">
                        <ul class="select_first_ul">
                            <?php foreach ($department as $v) { ?>
                                <li><p data-type="<?php echo $v['id'] ?>"><?php echo $v['name'] ?></p></li>
                            <?php } ?>
                        </ul>
                    </div>
                </div>
            </li>
            <!--请选择状态-->
            <li>
                <div class="selectlist">
                    <div class="select_textdiv">
                        <input type="hidden" id="status" value="">
                        <div>
                            <p class="s_text one-txt-cut">请选择状态</p>
                            <span class="down"><i class="iconfont icon-xiaosanjiaodown"></i></span>
                        </div>
                    </div>
                    <div class="select_textul">
                        <ul class="select_first_ul">
                            <?php foreach ($status as $k=>$v){?>
                            <li><p data-type="<?php echo $k?>"><?php echo $v?></p></li>
                            <?php }?>
                        </ul>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</div>
<hr class="bgcolor"/>

<!--最热提议-->
<div class="index-main hot-proposal">
    <div class="main-content proposal-content">
        <div class="c-list">

        </div>
    </div>
</div>

</body>

</html>
<script>

    get_jdz_list();

    function get_jdz_list() {
        var question_type = $('#question_type').val();
        var depart_id = $('#depart_id').val();
        var status = $('#status').val();
        var title = $("#title").val();
        $.ajax({
            url: '<?php echo url('get_all_list')?>',
            data: {
                question_type: question_type,
                depart_id: depart_id,
                status: status,
                title: title,
            },
            type: 'post',
            success: function (data) {
                $(".c-list").html(data);
            }
        })
    }

    function search() {
        var title = $('#title').val();
        window.location.href = "/index/propose/alljdz.html?title=" + title;
    }

    $(function () {
        var page = 2;
        var load_flag = true;
        $(window).scroll(function () {
            var question_type = $('#question_type').val();
            var depart_id = $('#depart_id').val();
            var status = $('#status').val();
            var title = $("#title").val();
            var totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
            var documentheight = parseFloat($(document).height());
            if (documentheight - totalheight <= 200) {
                if (load_flag) {
                    load_flag = !load_flag;
                    $.ajax({
                        url: '<?php echo url('get_all_list')?>',
                        data: {
                            question_type: question_type,
                            depart_id: depart_id,
                            status: status,
                            title: title,
                            page: page
                        },
                        success: function (data) {
                            $(".c-list").append(data);
                            load_flag=!load_flag;
                            page++;
                        }
                    })
                }
            }
        });
    });
</script>